const webpack = require('webpack')

module.exports = {
  entry: {
    index: './js/index'
  },
  output: {
    path: '../www/js',
    filename: '[name].js'
  },
  devtool: 'source-map',
  resolve: {
    extensions: ['.ts', '.js']
  },
  externals: {
    'jquery': 'jquery'
  },
  plugins: [
    new webpack.ProvidePlugin({
      $: 'jquery'
    })
  ],
  module: {
    rules: [
      {
        test: /\.js$/,
        use: 'babel-loader'
      },
      {
        test: /\.ts$/,
        use: [
          {
            loader: 'babel-loader',
            options: {
              presets: ['env']
            }
          },
          'ts-loader'
        ]
      }
    ]
  }
}
